package com.ruoyi.merchant.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.merchant.mapper.MerchantUsageRecordMapper;
import com.ruoyi.merchant.domain.MerchantUsageRecord;
import com.ruoyi.merchant.service.IMerchantUsageRecordService;

/**
 * 优惠券使用记录Service业务层处理
 * 
 * @author dongdong
 * @date 2025-10-29
 */
@Service
public class MerchantUsageRecordServiceImpl implements IMerchantUsageRecordService 
{
    @Autowired
    private MerchantUsageRecordMapper merchantUsageRecordMapper;

    /**
     * 查询优惠券使用记录
     * 
     * @param id 优惠券使用记录主键
     * @return 优惠券使用记录
     */
    @Override
    public MerchantUsageRecord selectMerchantUsageRecordById(Long id)
    {
        return merchantUsageRecordMapper.selectMerchantUsageRecordById(id);
    }

    /**
     * 查询优惠券使用记录列表
     * 
     * @param merchantUsageRecord 优惠券使用记录
     * @return 优惠券使用记录
     */
    @Override
    public List<MerchantUsageRecord> selectMerchantUsageRecordList(MerchantUsageRecord merchantUsageRecord)
    {
        return merchantUsageRecordMapper.selectMerchantUsageRecordList(merchantUsageRecord);
    }

    /**
     * 新增优惠券使用记录
     * 
     * @param merchantUsageRecord 优惠券使用记录
     * @return 结果
     */
    @Override
    public int insertMerchantUsageRecord(MerchantUsageRecord merchantUsageRecord)
    {
        merchantUsageRecord.setCreateTime(DateUtils.getNowDate());
        return merchantUsageRecordMapper.insertMerchantUsageRecord(merchantUsageRecord);
    }

    /**
     * 修改优惠券使用记录
     * 
     * @param merchantUsageRecord 优惠券使用记录
     * @return 结果
     */
    @Override
    public int updateMerchantUsageRecord(MerchantUsageRecord merchantUsageRecord)
    {
        return merchantUsageRecordMapper.updateMerchantUsageRecord(merchantUsageRecord);
    }

    /**
     * 批量删除优惠券使用记录
     * 
     * @param ids 需要删除的优惠券使用记录主键
     * @return 结果
     */
    @Override
    public int deleteMerchantUsageRecordByIds(Long[] ids)
    {
        return merchantUsageRecordMapper.deleteMerchantUsageRecordByIds(ids);
    }

    /**
     * 删除优惠券使用记录信息
     * 
     * @param id 优惠券使用记录主键
     * @return 结果
     */
    @Override
    public int deleteMerchantUsageRecordById(Long id)
    {
        return merchantUsageRecordMapper.deleteMerchantUsageRecordById(id);
    }
}
